namespace Framework.Core.Search
{
    public class SearchOperatorItem
    {
        private string text;

        public string Text
        {
            get { return text; }
            set { text = value; }
        }

        private string expression;

        public string Expression
        {
            get { return expression; }
            set { expression = value; }
        }

        public SearchOperatorItem(string text, string expression)
        {
                this.text = text;
                this.expression = expression;
        }

        public override bool Equals(object obj)
        {
            if (!Equals(this.GetType(), obj.GetType()))
            {
                return false;
            }
            SearchOperatorItem searchOperatorItem = (SearchOperatorItem)obj;
            if (this.Expression.Equals(searchOperatorItem.Expression)
                && this.Text.Equals(searchOperatorItem.Text))
            {
                return true;
            }
            return false;
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((text != null ? text.GetHashCode() : 0)*397) ^ (expression != null ? expression.GetHashCode() : 0);
            }
        }
    }
}
